#include "dominion.c"
#include "assert.h"
#include "stdio.h"
#include "rngs.c"

void checkVillageCardPlay( struct gameState *state );

int main(){
	int *cards = kingdomCards(7,8,9,10,11,12,13,14,15,16);
	struct gameState *state = newGame();
	
	initializeGame(4, cards, -1, state);
	
	for (int i = 0; i < 10; i++){
		checkVillageCardPlay( state );	
	}
	
	return 0;
}

void checkVillageCardPlay( struct gameState *state ) {
	int player = 0;
	int card = village;
	int actions = state->numActions;
	
	// We need to replace one of the current cards with a village randomly
	int handPos = (int)(Random() * state->handCount[player]);
	state->hand[player][handPos] = card;
	
	cardEffect(card, 0, 0, 0, state, handPos, 0);
	
	// NOTE:: Without a return value, we can't check if drawCard worked properly or not
	// For example, a player won't gain a card if their deck and discard piles are both empty
	
	if (actions != state->numActions - 2){
		printf("Action count mismatch! Actions before: %d. Actions after: %d.\n", actions, state->numActions);
		assert(0);
	}
}